<template>
  <div class="container">
    <template>
   <el-input placeholder="请输入药品名称" v-model="input" class="input-with-select">
    <el-button slot="append" icon="el-icon-search" @click="parentsearch"></el-button>
  </el-input>
  <el-table
    :data="list"
    border
    height="300"
    style="width:420px;"
    ref="multipleTable"
    tooltip-effect="dark"
    @selection-change="handleSelectionChange">
    <el-table-column
      type="selection"
      width="49">
    </el-table-column>
    <el-table-column
      prop="name"
      label="药品名称"
      width="150">
    </el-table-column>
    <el-table-column
      prop="total"
      label="重量"
      width="60">
    </el-table-column>
    <el-table-column
      prop="price"
      label="价格"
      width="60">
    </el-table-column>
      <el-table-column
      prop="frequency"
      label="用量"
      width="90">
    </el-table-column>
  </el-table>
   <el-button type="primary" @click="parentadd">添加药品</el-button>
</template>
  </div>
</template>

<script>
 export default {
  props:['list'],
    data() {
      return {
        multipleSelection: [],
        input:''
      }
       
    },
    methods:{
       handleSelectionChange(val) {
        this.multipleSelection = val;
      },
      parentadd(){
        this.$emit('addData',this.multipleSelection)
      },
      parentsearch(){
        this.$emit("parentsearch",this.input);
      }
    }
  }
</script>

<style lang="less" scoped>
.container{
  // padding: 20px;
  margin-right: 10px;
}
/deep/.el-table{
  text-align: center;
}
/deep/.el-input-group{
  width: 380px;
  margin-bottom: 10px;
}
/deep/.el-input__inner{
  width: 335px;
}
/deep/.el-button{
  margin-top: 10px;
}

</style>